package indi.gtl.superbrain.fragment;

import java.util.ArrayList;
import java.util.List;

import indi.gtl.superbrain.adapter.FriendRankAdapter;
import indi.gtl.superbrain.models.UserInfo;
import indi.gtl.superbrain.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

public class MainSecondFragment extends Fragment{
	int img[]={R.drawable.ic_launcher,R.drawable.ic_launcher,R.drawable.ic_launcher,R.drawable.ic_launcher};
	String name[]={"sun","shine","tomorrow","world"};
	int score[]={12405,13479,9870,7534};
	ListView main_second_frindrank;
	List<UserInfo>list;
	UserInfo info;
	FriendRankAdapter adapter;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view=inflater.inflate(R.layout.main_second_layout, null);
		main_second_frindrank=(ListView) view.findViewById(R.id.main_second_frindrank);
		
		list=new ArrayList<UserInfo>();
		
		for (int i = 0; i < img.length; i++) {
			info=new UserInfo();
			info.name = name[i];
			info.head = img[i];
			info.sum_score = score[i];
			list.add(info);
		}
		
		adapter=new FriendRankAdapter(getActivity(),list);
		main_second_frindrank.setAdapter(adapter);
		return view;
	}
	
}
